d = {}
with open("sample.txt",'r') as f:
     for line in f:
         l =line.replace('.',' ').replace('(',' ').replace(')',' ').replace('\\',' ').replace(',',' ').replace('/',' ').replace('?',' ').replace('=',' ').lower().split()
         for i in l:
             if i in d.keys():
                 d[i] += 1
             else:
                 d[i] = 1
     lit=sorted([(j[1],j[0]) for j in d.items()],reverse=True)
     h=lit[:10]
     for i in h:
         print("{},{}".format(i[1],i[0]))

# 效率会差一些，可以想想有没有别的方法可以解决
